<?php
	namespace app\models\sbb;
	use yii\db\ActiveRecord;
	/**
	* 
	*/
	class user extends ActiveRecord
	{
		
		public function rules(){
			return [
				['username','required'],
				['phone','integer','message'=>'非法字符'],
				['phone','match','pattern'=>'/^1[0-9]{10}$/','message'=>'必须为1开头的11位纯数字'],
				['phone','required','message'=>'手机号码不能为空']
			];
		}
		public function get_verify_phone($length=6){
			$verify=null;
			while($length--){
				$str = join('',range(0,9));
				$str = str_shuffle($str);
				$str = substr($str, 1,1);
				$verify=$verify.$str;
			}
			return $verify;
		}
	}
?>